<template>
  <div class="card">
    <moduleHead title="待审批信息" styleName="green"></moduleHead>
    <el-form v-if="details.workOrderAudit" class="key-value" label-width="130px" label-suffix="：">
      <el-form-item label="审批类型">{{ details.workOrderAudit.type | workOrderAuditType }}</el-form-item>
      <el-form-item label="审批状态">{{ details.workOrderAudit.auditStatus }}</el-form-item>
      <template v-if="details.workOrderAudit.type === '05'">
        <el-form-item label="承办单位">{{ details.workOrderAudit.nextDepartment }}</el-form-item>
        <el-form-item label="自办/转办备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '03'">
        <el-form-item label="不受理原因">{{ details.workOrderAudit.applyReason }}</el-form-item>
        <el-form-item label="不受理备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '01'">
        <el-form-item label="中止原因">{{ details.workOrderAudit.applyReason }}</el-form-item>
        <el-form-item label="中止备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '07'">
        <el-form-item label="提交办结类型">{{ details.workOrderAudit.applyReason }}</el-form-item>
        <el-form-item label="提交办结理由">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '00'">
        <el-form-item label="延期原因">{{ details.workOrderAudit.applyReason }}</el-form-item>
        <el-form-item label="延期天数">{{ details.workOrderAudit.applyOther !== "null" ? details.workOrderAudit.applyOther : 30 }}天</el-form-item>
        <el-form-item label="延期备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '04'">
        <el-form-item label="移交单位">{{ details.workOrderAudit.nextDepartment }}</el-form-item>
        <el-form-item label="移交备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '06'">
        <el-form-item label="是否公开">{{ details.workOrderAudit.publicStatus | workOrderPublicStatus }}</el-form-item>
        <el-form-item label="办结理由">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
        <el-form-item label="结案状态">
          <div>{{ details.finishStatus }}</div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '28' || details.workOrderAudit.type === '27'">
        <!-- <el-form-item label="办理时限">{{ details.workOrderAudit.applyOther }}</el-form-item> -->
        <el-form-item label="退回重办备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '25'">
        <el-form-item label="提交终止类型">{{ details.workOrderAudit.applyReason }}</el-form-item>
        <el-form-item label="提交终止备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '02'">
        <el-form-item label="是否公开">{{ details.workOrderAudit.publicStatus | workOrderPublicStatus }}</el-form-item>
        <el-form-item label="终止备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '09'">
        <el-form-item label="直办备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>
      <template v-if="details.workOrderAudit.type === '10'">
        <el-form-item label="指定办理备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>
      <template v-if="details.workOrderAudit.type === '11'">
        <el-form-item label="转办备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>
      <template v-if="details.workOrderAudit.type === '12'">
        <el-form-item label="交办备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '21'">
        <el-form-item label="退回修改内容">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
        <el-form-item label="退回补正内容">
          <div v-html="txt2HTML(details.workOrderAudit.applyReason)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '29'">
        <el-form-item label="案件名称">
          <div v-html="txt2HTML(details.workOrderAudit.title)"></div>
        </el-form-item>
        <el-form-item label="案件类型">
          <div>
            {{ details.itemDetailName }}
          </div>
        </el-form-item>
        <el-form-item label="推送单位">
          <div>
            {{ details.pushDepartmentList.map((item) => item.departmentName).join("、") }}
          </div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '24'">
        <el-form-item label="申请理由">
          <div>
            {{ details.workOrderAudit.applyReason }}
          </div>
        </el-form-item>
        <el-form-item label="申请备注">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>

      <template v-if="details.workOrderAudit.type === '23'">
        <el-form-item label="复核理由">
          <div v-html="txt2HTML(details.workOrderAudit.applyComment)"></div>
        </el-form-item>
      </template>
      <template v-if="details.workOrderAudit.type === '31'">
        <el-form-item label="确认退回理由">
          <div>{{ details.workOrderAudit.applyReason }}</div>
        </el-form-item>
        <el-form-item label="确认退回报告">
          <upload-preview :file-list="details.makeSureReturnAttachments" btnType="text"></upload-preview>
        </el-form-item>
      </template>
      <template v-if="details.workOrderAudit.type === '30'">
        <el-form-item label="受理备注">
          <div>{{ details.workOrderAudit.applyComment }}</div>
        </el-form-item>
        <el-form-item label="受理通知书">
          <upload-preview :file-list="details.receiveAttachments" btnType="text"></upload-preview>
        </el-form-item>
      </template>

      <el-form-item label="结案反馈">
        {{ workOrderAudit.satisfactionLevel | workOrderAtisFactionLevel }}
      </el-form-item>

      <template v-if="['25'].includes(this.details.workOrderAudit.type)">
        <el-form-item v-if="details.overWorkOrderVo.reportFile.length" :label="fileLabelName">
          <upload-preview :file-list="details.overWorkOrderVo.reportFile" btnType="text"></upload-preview>
        </el-form-item>
        <el-form-item v-if="details.overWorkOrderVo.reportNoticeFile.length" :label="fileLabelName1">
          <upload-preview :file-list="details.overWorkOrderVo.reportNoticeFile" btnType="text"></upload-preview>
        </el-form-item>
        <el-form-item v-if="details.overWorkOrderVo.attachmentList.length" label="附件">
          <upload-preview :file-list="details.overWorkOrderVo.attachmentList" btnType="text"></upload-preview>
        </el-form-item>
      </template>
      <template v-else-if="['07'].includes(this.details.workOrderAudit.type)">
        <el-form-item v-if="details.workOrderSubmitFinishResult.reportList.length" :label="fileLabelName">
          <upload-preview :file-list="details.workOrderSubmitFinishResult.reportList" btnType="text"></upload-preview>
        </el-form-item>

        <el-form-item v-if="details.workOrderSubmitFinishResult.reportNoticeFile.length" :label="fileLabelName1">
          <upload-preview :file-list="details.workOrderSubmitFinishResult.reportNoticeFile" btnType="text"></upload-preview>
        </el-form-item>

        <el-form-item v-if="details.workOrderSubmitFinishResult.attachmentList.length" label="附件">
          <upload-preview :file-list="details.workOrderSubmitFinishResult.attachmentList" btnType="text"></upload-preview>
        </el-form-item>

        <template v-if="details.status === 3 && details.auditFlag === 'Y' && type === 'audit'">
          <el-row :gutter="20" v-if="details.questionMainInfo.isArrear">
            <el-col :span="8">
              <el-form-item label="欠款金额">{{ details.questionMainInfo?.govArrears?.arrearsAmount | unitMoney }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="已支付金额">{{ details.payedAmount | unitMoney }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="已制定支付计划金额" label-width="154px">
                {{ details.makePayPlanAmount | unitMoney }}
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="支付备注">
                <div v-html="txt2HTML(details.payNote)"></div>
              </el-form-item>
            </el-col>
          </el-row>
        </template>
      </template>
      <template v-else>
        <el-form-item v-if="details.workOrderAudit.attachmentFile.length" :label="fileLabelName2">
          <upload-preview :file-list="details.workOrderAudit.attachmentFile[0]" btnType="text"></upload-preview>
        </el-form-item>
      </template>
    </el-form>
  </div>
</template>

<script>
import { txt2HTML, workOrderAtisFactionLevel, workOrderAuditType, unitMoney, workOrderPublicStatus } from "@/utils/filters";
import UploadPreview from "../../../components/uploadInput/uploadPreview.vue";
import detail from "@/views/statistics/statistics/details";
export default {
  name: "StayApprovalMsg",
  components: { UploadPreview },
  filters: {
    workOrderAtisFactionLevel,
    workOrderAuditType,
    unitMoney,
    workOrderPublicStatus,
  },
  props: {
    details: {
      type: Object,
      default: () => {},
    },
    // 列表页面的标识，审批中心页面【audit】
    type: {
      type: String,
      default: "",
    },
  },
  computed: {
    workOrderAudit() {
      return this.details.workOrderAudit || {};
    },
    fileLabelName() {
      let name = "报告";
      switch (this.details.workOrderAudit.type) {
        case "07":
          name = "结案意见书";
          break;
        case "25":
          name = "终止意见书";
          break;

        default:
          break;
      }
      return name;
    },
    fileLabelName1() {
      let name = "报告";
      switch (this.details.workOrderAudit.type) {
        case "07":
          name = "结案通知书";
          break;
        case "25":
          name = "终止通知书";
          break;

        default:
          break;
      }
      return name;
    },
    fileLabelName2() {
      let name = "附件";
      switch (this.details.workOrderAudit.type) {
        case "01":
          name = "中止调查报告单";
          break;

        default:
          break;
      }
      return name;
    },
  },
  data() {
    return {};
  },
  watch: {},

  created() {},
  methods: { txt2HTML },
};
</script>

<style lang="less" scoped>
.el-form-item__content {
  div {
    word-break: break-all;
  }
}
</style>
